#include <string>
#include <algorithm>

#include "observer.h"
#include "subject.h"

void Boss::Attach(Observer *observer)
{
    observers.push_back(observer);
}

void Boss::Detach(Observer *observer)
{
    auto iter = find(observers.begin(), observers.end(), observer);
    if (iter != observers.end()) {
        observers.erase(iter);
    }
}

void Boss::Notify()
{
    for (auto observer : observers) {
        observer->Update();
    }
}